package com.his.his_system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.his.his_system.domain.DzmHisHospital;
import com.his.his_system.domain.DzmHisHospitalMedicinesRelation;
import com.his.his_system.service.DzmHisHospitalMedicinesRelationService;
import com.his.his_system.mapper.DzmHisHospitalMedicinesRelationMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Array;
import java.util.ArrayList;

/**
* @author 冯心愿
* @description 针对表【dzm_his_hospital_medicines_relation(医院药品关联表)】的数据库操作Service实现
* @createDate 2023-07-06 14:27:11
*/
@Service
public class DzmHisHospitalMedicinesRelationServiceImpl extends ServiceImpl<DzmHisHospitalMedicinesRelationMapper, DzmHisHospitalMedicinesRelation>
    implements DzmHisHospitalMedicinesRelationService{
    private final  Long NOWTIME = System.currentTimeMillis()/1000;
    @Autowired
    private DzmHisHospitalMedicinesRelationMapper hmMapper;

    @Override
    public boolean saves(ArrayList<Integer> ids) {

        ArrayList<DzmHisHospitalMedicinesRelation> hms = new ArrayList<>();
        for (Object id : ids) {
            DzmHisHospitalMedicinesRelation hm = new DzmHisHospitalMedicinesRelation();
            hm.setMedicinesId((Integer) id);
            hm.setHospitalId(1);
            hm.setCreateTime(NOWTIME);
            hm.setUpdateTime(NOWTIME);
            hms.add(hm);
        }
        boolean b = saveBatch(hms);
        return b;
    }

}




